<template>
  <el-dialog :title="title" :width="width" :visible.sync="isShowVisible" center :close-on-click-modal="false" :before-close="() => $emit('close')">
    <el-card v-loading="isLoading">
      <el-form label-width="105px">

        <el-row>
          <el-col :span="8">
            <el-form-item label="设备编码:">
              <span>{{groupData.fnumber}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="设备名称:">
              <span>{{groupData.fname}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="设备简称:">
              <span>{{groupData.fsimplename}}</span>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="型号:">
              <span>{{groupData.fmodel}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="功率:">
              <span>{{groupData.fpower}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item label="设备分类:"><!--:disabled="groupId != 0"-->
          <el-select v-model="groupData.fgroupid" disabled class="select-disabled">
            <el-option v-for="item in groupList" :key="item.nodeId" :label="item.nodeName" :value="item.nodeId">
            </el-option>
          </el-select>
        </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="出厂编号:">
              <span>{{groupData.foutnumber}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="出厂日期:">
              <span>{{groupData.foutdate}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="购入日期:">
              <span>{{groupData.fbuydate}}</span>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="使用地点:">
              <span>{{groupData.fuseaddress}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="生产厂家:">
              <span>{{groupData.fmanufacturer}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="验收日期:">
              <span>{{groupData.fcheckindate}}</span>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="采集数据:">
              <!--<span>{{groupData.fiscollectdata}}</span>-->
              <span v-if="groupData.fiscollectdata !==0">是</span>
              <span v-else>否</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="关键设备:">
              <!--<span>{{groupData.fiskey}}</span>-->
              <span v-if="groupData.fiskey !==0">是</span>
              <span v-else>否</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="主设备:">
              <!--<span>{{groupData.fismain}}</span>-->
              <span v-if="groupData.fismain !==0">是</span>
              <span v-else>否</span>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="技术水平:">
              <el-select v-model="groupData.flevel" disabled class="select-disabled" >
                <el-option v-for="item in returnTypeList" :key="item.code" :label="item.name" :value="item.code">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="运行状态:">
              <el-select v-model="groupData.frunstate" disabled class="select-disabled" >
                <el-option v-for="item in returnResultList" :key="item.code" :label="item.name" :value="item.code">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="关联主设备:"><!--:disabled="groupId != 0"-->
              <el-select v-model="groupData.eparentid"  disabled class="select-disabled">
              <!--  <el-option v-for="item in FisMain" :key="item.fid" :label="item.fname" :value="item.fid">
                </el-option>-->
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="吨位:">
              <span>{{groupData.ftonnage}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="车间:"><!--:disabled="groupId != 0"-->
              <span>{{groupData.fuseaddress}}</span>
            <!--  <el-select v-model="groupData.ffactopryid"  >
                <el-option v-for="item in queryFactoryList" :key="item.deptId" :label="item.deptName" :value="item.deptId">
                  <span>{{item.deptName}}</span>
                </el-option>
              </el-select>-->
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="顺序:">
              <span>{{groupData.forderno}}</span>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="备注:">
              <span>{{groupData.fremark}}</span>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
    </el-card>
    <div slot="footer" class="dialog-footer">
      <el-button @click="$emit('close')">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
    import EquipmentGroupApi from "../../../api/module/EquipmentGroupApi";

    export default {
        name: "facility_detail",
        props: {
          width: {
            type: String,
            default: '60vw'
          },
          fid: {
            type: Number,
          },
        },
        data () {
          return {
            title: '设备详情',
            isShowVisible: true,
            isLoading: false,
            groupData: {},
            groupList: [],
            returnTypeList:[],
            returnResultList:[],
            queryFactoryList:[],
           // FisMain:[],
            http:new EquipmentGroupApi(),
          }
        },
        async created () {
          console.log("设备--详情:"+this.fid)
          this.isLoading = true
          let groupList = await this.http.queryGroupTree({})

          let queryFactoryList = await this.http.queryFactoryList({})
          this.queryFactoryList = queryFactoryList.data;

          //let FisMain = await http.getFisMain({})
          let returnTypeList = await this.http.getEnum({sysName:"tie-demo",className:"cn.hxlc.tie.demo.core.enums.LevelEnum"});
          this.returnTypeList = returnTypeList.data;
          console.log("枚举")
          console.log(returnTypeList);
          let returnResultList = await this.http.getEnum({sysName:"tie-demo",className:"cn.hxlc.tie.demo.core.enums.DeptEnum"})
          this.returnResultList = returnResultList.data;
          console.log(returnResultList)
          this.groupList = groupList.data
          let groupData = await this.http.detail({ fid: this.fid })
          this.groupData = groupData.data
          this.isLoading = false
        },
    }
</script>

<style scoped>

</style>
